<?php 
// Include common page and functions
require_once ( 'app-config.php');
include get_header_page();
?>

<?php

// Get parameters
$categoryid = $_GET['cid'];
$current_page = get_current_page();

// Get Category Name
$category_name = get_category_name($categoryid);

// Initial Page Util
$pager_util = new PagerUtil($current_page,get_product_count($categoryid),PAGE_SIZE,2);

// Get products list
$products_list = get_product_list($categoryid,$pager_util->RECORD_OFFSET,$pager_util->PAGE_SIZE);

?>

<!-- MAIN_CONTAINER -->
<div id="main_container">
	<br>
	<!-- FRAME -->
	<div id="frame">

		<!-- BEGIN CONTENT -->
		<div id="content">

			<div id="content-inner">
				<div id="head-top-inner">
					<div id="head-title-inner">
						<h2><?php _echo($category_name);?></h2>
					</div>
				</div>
				<div class="maincontent">
					<?php 

					if(isset($products_list) && count($products_list)>0)
					{
						while((list($key,$product)=each($products_list)))
						{
							?>
					<div class="blog-post">
						<img
							src="<?php echo IMG_PRODUCT_DIR.'/'.$product['photo_id'];?>"
							alt="<?php echo $product['name_zh_CN'];?>" class="alignleft" width="75px" height="70px"/>
						<h4>
							<?php echo $product['name_zh_CN'];?>
							<a	href="<?php echo HOST_URL.'/pd-detail.php?pid='.$product['id'];?>" target="_blank" style="font-size: 12px;">
								详细
							</a>
						</h4>
						<p><?php echo $product['brief_zh_CN'];?></p>
						<div class="blog-posted">
						</div>
					</div>
					<?php
						}
					}
					else 
						echo "<p style='font-size:14px;'>没有相应产品！</p>";
					?>
				</div>
				<div class="blog-pagination">
					<!-- page pagination -->
					<div class="navigation">
						<div class="alignleft">
							<?php $pager_util->display('&cid='.$categoryid)?>
						</div>
						<div class="alignright"></div>
						<div class="clear"></div>
					</div>
				</div>
			</div>

			<?php include ('siderbar.php');?>
		</div>
		<!-- END OF CONTENT -->
	</div>
	<!-- END OF FRAME -->
</div>
<!-- END OF MAIN_CONTAINER -->

<?php include get_footer_page();?>    
